# Methods added to this helper will be available to all templates in the application.
module ApplicationHelper

  def destaque
    #Janela 'Destaque'
    Destaque.find(rand(4)+1)
  end

  def novidade
    #Janela 'Novidades'
    Novidade.find(1)
  end

  def maisvendidos
    #Janela 'Mais Vendidos'
    Evento.find(:all)
  end

  def carrinho
    
  end

  def categorias
    Categoria.find(:all)
  end

  def page_entries(collection, options = {})
    entry_name = options[:entry_name] ||
      (collection.empty?? 'entry' : collection.first.class.name.underscore.sub('_', ' '))

    if collection.total_pages < 2
      case collection.size
      when 0; I18n.t(:nenhum, :item => entry_name)  #"Nenhum #{entry_name.pluralize} encontrado"
      when 1; I18n.t(:show, :item => entry_name)  #"Mostrando <b>1</b> #{entry_name}"
      else;   I18n.t(:show_s, :size => collection.size, :item => entry_name.pluralize)  #"Mostrando <b>all #{collection.size}</b> #{entry_name.pluralize}"
      end
    else
      I18n.t(:show_lst, :item => entry_name.pluralize, :it0 => collection.offset + 1, :it1 => collection.offset + collection.length, :it2 => collection.total_entries)
    end
  end

end
